﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;

namespace FinancialDB
{
    public partial class home_Stock_Panel : Form
    {
        public home_Stock_Panel()
        {
            InitializeComponent();
        }

        private void home_Stock_Panel_Load(object sender, EventArgs e)
        {
            ToolTip toolTip = new ToolTip();
            toolTip.ReshowDelay = 10;
            toolTip.SetToolTip(this.label7, "加入我的主页");
        }

        private void linkLabel56_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            XmlDocument xmldoc = new XmlDocument();
            xmldoc.Load(@"../../Users/userdata.xml");
            XmlNode firstpage = xmldoc.SelectSingleNode("/root/firstpage");
            ((XmlElement)firstpage).SetAttribute("name", "stock");
            xmldoc.Save(@"../../Users/userdata.xml");

            MessageBox.Show("已将当前页设置为默认首页。", "信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
        }

        private void label8_MouseEnter(object sender, EventArgs e)
        {
            Label llabel = sender as Label;
            llabel.Parent.BackColor = System.Drawing.Color.FromArgb(255, 48, 48);
            llabel.ForeColor = Color.White;
        }

        private void label8_MouseLeave(object sender, EventArgs e)
        {
            Label llabel = sender as Label;
            llabel.Parent.BackColor = Color.Transparent;
            llabel.ForeColor = System.Drawing.Color.FromArgb(0, 0, 255);
        }

        private void label7_MouseEnter(object sender, EventArgs e)
        {
            Label llabel = sender as Label;
            llabel.Parent.BackColor = System.Drawing.Color.FromArgb(255, 48, 48);
            label8.ForeColor = Color.White;
        }

        private void label7_MouseLeave(object sender, EventArgs e)
        {
            Label llabel = sender as Label;
            llabel.Parent.BackColor = Color.Transparent;
            label8.ForeColor = System.Drawing.Color.FromArgb(0, 0, 255);
        }

        private void label8_Click(object sender, EventArgs e)
        {

        }

        private void label7_Click(object sender, EventArgs e)
        {
            Form form = new addHomepage_Form();
            form.WindowState = FormWindowState.Normal;
            form.StartPosition = FormStartPosition.CenterScreen;
            TextBox textBox1 = form.Controls.Find("textBox1", true)[0] as TextBox;
            textBox1.Text = label8.Text;
            form.Show();
        }
    }
}
